﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using CashFlow.Web.Def;
using CashFlow.Db.Entity;

namespace CashFlow.Web.Service
{
    public interface IUserService : IService<UserInfoEntity>
    {
        /// <summary>
        /// Register
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="pwd"></param>
        /// <param name="name"></param>
        /// <param name="referenceInvitationCode"></param>
        /// <returns></returns>
        ERegisterResult Register(string phone
            , string pwd
            , string name
            , string referenceInvitationCode);

        /// <summary>
        /// Login
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        ELoginResult Login(string phone, string pwd);

        /// <summary>
        /// Logout
        /// </summary>
        void Logout();

        /// <summary>
        /// Get Login User
        /// </summary>
        /// <returns></returns>
        UserInfoEntity GetLoginUser();

        /// <summary>
        /// Is Login
        /// </summary>
        /// <returns></returns>
        bool IsLogin();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        ShopInfoEntity GetLoginShopInfo();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        bool IsShopManager();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        bool IsRootUser();

        IList<UserInfoEntity> QueryAllChildUsersByUserId(
            int userId
            , int? state);

        IList<int> QueryAllChildUserIdsByUserId(
            int userId
            , int? state);

        IList<UserInfoEntity> QueryShopUsersByUserId(
            int userId
            , int? state);

        IList<int> QueryShopUserIdsByUserId(
            int userId
            , int? state);

        bool UpdatePwd(string oldPwd, string newPwd);

        IList<UserInfoEntity> QueryShopFstGenChildUsersByUserId(
            int userId
            , int? state);
    }
}
